package Messages;

import Agents.Messageable;
import Agents.Bin;

public class BinMessage extends AMessage
{
	public int weight;
	public int volume;
	public int speed;
	
	protected String constructSpecialMessage(Messageable agent) 
	{
		return null;
	}

	protected String constructSpecialMessage(Messageable agent, MessageType type) 
	{
		if (type == AMessage.MessageType.CALL_EMPTY_BIN)
			return (agent.getLocalName() + AMessage.senderSplit + 
					AMessage.Units.WEIGHT  + AMessage.unitSplit + ((Bin)agent).weight + AMessage.unitsSplit + 
					AMessage.Units.VOLUME  + AMessage.unitSplit + ((Bin)agent).volume);
		return null;
	}

	protected void retrieveMyMessage(String theMessage) 
	{
		String[] send = theMessage.split(AMessage.senderSplit);
		sender = send[0];
		String[] units = send[1].split(AMessage.unitsSplit);
		String[] weight = units[0].split(AMessage.unitSplit);
		String[] volume = units[1].split(AMessage.unitSplit);

		this.weight = Integer.parseInt(weight[1]);
		this.volume = Integer.parseInt(volume[1]);
	}
}
